<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<style type="text/css">
		*{
			margin: 0px;
			padding: 0px;
		}
		#txt{
			width: 400px;
			height: 400px;
			display: block;
			border: 1px solid;
			background-color: #000000;
			position: relative;
		}
		button{
			position: absolute;
			right: 5px;
			top: 15px;
		}
	</style>
	<body>
		<div id="txt">
			<button id="button" onclick="abc()">点击全屏</button>
		</div>
	</body>
	<script type="text/javascript">
		function abc() {
			var html = document.getElementById("button").innerHTML;
			if (html == "点击全屏") {
				document.getElementById("txt").style.width = "100%";
				var h = document.documentElement.clientHeight;
				document.getElementById("txt").style.height = h + "px";
				document.getElementById("button").innerHTML = "点击还原";
			}
			if(html == "点击还原") {
				document.getElementById("txt").style.width = "400px";
				document.getElementById("txt").style.height = "400px";
				document.getElementById("button").innerHTML = "点击全屏";
			}
		}
	</script>
</html>
